﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Wicresoft.UnifyShow.Business;
using Microsoft.Practices.Unity;

namespace Wicresoft.UnifyShow.Portal.Controllers
{
    public class BasicEnvironmentDetailController : BaseController
    {

        private ISiteBranch siteBranch;
        private IUser_X user;
        private IBusinessSystem businessSystem;
        protected override void Dispose(bool disposing)
        {
            ((IDisposable)siteBranch).Dispose();
            ((IDisposable)user).Dispose();
            ((IDisposable)businessSystem).Dispose();
        }

        [InjectionConstructor]
        public BasicEnvironmentDetailController(ISiteBranch siteBranch, IUser_X user, IBusinessSystem businessSystem)
        {
            this.siteBranch = siteBranch;
            this.user = user;
            this.businessSystem = businessSystem;
        }


        //
        // GET: /BasicEnvironmentDetail/

        public ActionResult Index()
        {
            base.SetRoles(user);
            if (UserID==-1) return new HttpStatusCodeResult(403);
            List<SiteBranchModel> sites = siteBranch.GetSiteALLBranch();

            ViewBag.Sites = (from c in sites
                             where UserSiteIDs.Contains(c.ID) 
                             select c).ToList();
            return View();
        }

    }
}
